package com.etoak.config;

import com.etoak.properties.ImageProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer;

@Configuration
public class WebFluxConfig  implements WebFluxConfigurer {

    @Autowired
    ImageProperties imageProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String mapper = imageProperties.getPrefix().endsWith("/")?
                imageProperties.getPrefix()+ "**":
                imageProperties.getPrefix() + "/**";

        registry.addResourceHandler("/files/**")
                .addResourceLocations("file:d:/upload/et2403/");
    }

}
